package com.jacobson.huobi.api

import com.alibaba.fastjson.JSONObject
import com.jacobson.huobi.common.HttpAuthentication
import com.jacobson.huobi.entities.VipRechargeCostInfo
import com.jacobson.huobi.entities.evt.VipRechargeSubmitEvt
import com.jacobson.huobi.entities.response.CommonResponse
import com.jacobson.huobi.entities.response.VipRechargeResponse
import com.jacobson.huobi.entities.vo.RechargeRecordVo
import io.reactivex.Observable
import okhttp3.MultipartBody
import retrofit2.http.*


interface VipRechargeApi {

    /**
     * 获取充值列表
     */
    @POST("vip/recharge_support/list/{vipLevel}?filter=true")
    @Headers(HttpAuthentication.HEADER)
    fun loadRechargeSupportList(
        @Path("vipLevel") vipLevel: Int
    ): Observable<VipRechargeResponse>

    /**
     * 获取交易费用
     */
    @POST("vip/recharge/cost/{recharge_support_id}")
    @Headers(HttpAuthentication.HEADER)
    fun loadRechargeCost(
        @Path("recharge_support_id") rechargeSupportId: Int
    ): Observable<CommonResponse<VipRechargeCostInfo>>


    /**
     * 上传交易截图
     */
    @Multipart
    @POST("vip/upload")
    @Headers(HttpAuthentication.HEADER)
    fun vipUpload(
        @Part file: MultipartBody.Part,
        @Query("width") width: Int = 150
    ): Observable<CommonResponse<JSONObject>>


    /**
     * 提交充值申请
     */
    @POST("vip/recharge/submit")
    @Headers(HttpAuthentication.HEADER)
    fun rechargeSubmit(
        @Body vipRechargeSubmitEvt: VipRechargeSubmitEvt
    ): Observable<CommonResponse<JSONObject>>

    /**
     * 提交充值申请
     */
    @POST("vip/record/{page}")
    @Headers(HttpAuthentication.HEADER)
    fun loadVipRecord(
        @Path("page") page: Int
    ): Observable<CommonResponse<List<RechargeRecordVo>>>

}